package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.NotificationSettingsMapper;
import com.ruoyi.system.domain.NotificationSettings;
import com.ruoyi.system.service.INotificationSettingsService;

/**
 * 通知设置，定义各门店的通知渠道及配置Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-13
 */
@Service
public class NotificationSettingsServiceImpl implements INotificationSettingsService
{
    @Autowired
    private NotificationSettingsMapper notificationSettingsMapper;

    /**
     * 通过id查询通知设置
     *
     * @param id 通知设置，定义各门店的通知渠道及配置主键
     * @return 通知设置，定义各门店的通知渠道及配置
     */
    @Override
    public NotificationSettings selectNotificationSettingsById(Long id)
    {
        return notificationSettingsMapper.selectNotificationSettingsById(id);
    }

    /**
     * 查询通知设置列表
     *
     * @param storeName 门店名称，定义各门店的通知渠道及配置
     * @return 通知设置，定义各门店的通知渠道及配置
     */
    @Override
    public List<NotificationSettings> selectNotificationSettingsListByName(String storeName)
    {
        return notificationSettingsMapper.selectNotificationSettingsListByName(storeName);
    }

    /**
     * 新增通知设置
     *
     * @param notificationSettings 通知设置，定义各门店的通知渠道及配置
     * @return 结果
     */
    @Override
    public int insertNotificationSettings(NotificationSettings notificationSettings)
    {
        return notificationSettingsMapper.insertNotificationSettings(notificationSettings);
    }

    /**
     * 修改通知设置
     *
     * @param notificationSettings 通知设置，定义各门店的通知渠道及配置
     * @return 结果
     */
    @Override
    public int updateNotificationSettings(NotificationSettings notificationSettings)
    {
        notificationSettings.setUpdateTime(DateUtils.getNowDate());
        return notificationSettingsMapper.updateNotificationSettings(notificationSettings);
    }

    /**
     * 批量删除通知设置信息
     *
     * @param ids 需要删除的通知设置，定义各门店的通知渠道及配置主键
     * @return 结果
     */
    @Override
    public int deleteNotificationSettingsByIds(Long[] ids)
    {
        return notificationSettingsMapper.deleteNotificationSettingsByIds(ids);
    }

    /**
     * 删除通知设置信息
     *
     * @param id 通知设置，定义各门店的通知渠道及配置主键
     * @return 结果
     */
    @Override
    public int deleteNotificationSettingsById(Long id)
    {
        return notificationSettingsMapper.deleteNotificationSettingsById(id);
    }
}
